#include <buola/image/format.h>
#include <buola/image/io.h>
#include <buola/image/drawing/basic.h>
#include <buola/image/adaptors.h>
#include <buola/image/views/cmaskedview.h>
#include <buola/image/rasterizer/cscanlinerasterizer.h>
#include <buola/image/rasterizer/cscanline.h>
#include <buola/image/cpath.h>
#include <buola/image/cimagegc.h>

using namespace buola;

int main()
{
    img::CImage_rgb8 lImage({320,200},img::CColor(L"DarkGray"));

    img::CImageGC<img::TFormat_rgb8> lGC(lImage);

    lGC.SetLineWidth(1.5);
//    lGC.SetLineCap(img::ELineCap::SQUARE);
    lGC.SetLineJoin(img::ELineJoin::MITER);
    img::CLinearGradient lGradient({0,0},{200,200});
    start_timer();
    for(int i=0;i<5000;i++)
    {
        lGC.Path().MoveTo({50,50});
        lGC.Path().LineTo({200,50});
        lGC.Path().LineTo({80,170});
        lGC.Path().LineTo({125,10});
        lGC.Path().LineTo({170,170});
        lGC.Path().LineTo({50,50});
        lGC.SetSource(lGradient);
        lGC.FillPath(true);
        lGC.SetSource(img::CColor(L"DeepPink",0.5));
        lGC.StrokePath();
    }
    end_timer();

    img::save(lImage,io::file("agg5.png"));
}
